<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			function fun(){
				var obj = document.getElementById("name");
				if(obj.value==""){
					obj.focus();
					obj.placeholder = "输入名字";
					return;
				}
				document.getElementById("note").innerHTML = obj.value;
				document.getElementsByTagName("h1")[1].style.color = "red";
				document.getElementsByTagName("input")[1].value = "确定";
			}
			function fun2 () {
				var x = document.getElementById("name");
				x.value = "李四";
			}
		</script>
	</head>
	<body>
		<script>
			document.write("<h1>测试</h1>");
			document.writeln("打印输出的文本<br />");
		</script>
		姓名:<input type="text" id="name" />
		<button onclick="fun()">提交</button>
		<button onclick="fun2()">变成李四</button>
		<input type="button" onclick="fun()"  value="测试按钮" />
		<h1>你输入的名字是：<span id="note"></span></h1>
	</body>
</html>
